﻿using System;
using System.Text;

namespace com.bodurov.NearestStarsVisualizer
{
    public class StarInfo
    {
        public int ID { get; set; }
        public string System { get; set; }
        public string Name { get; set; }
        public string StellarClass { get; set; }
        public string StellarClassDescription { get; set; }
        public int Color { get; set; }
        public double? ApparentMagnitude { get; set; }//(mV)
        public double? AbsoluteMagnitude { get; set; }//(MV)
        public double? EffectiveTemperature { get; set; }//K
        public int RightAscensionH { get; set; }
        public int RightAscensionM { get; set; }
        public double RightAscensionS { get; set; }
        public int DeclinationD { get; set; }
        public int DeclinationM { get; set; }
        public double DeclinationS { get; set; }
        public double? DistanceLightYears { get; set; }
        public int? NumberKnownPlanets { get; set; }
        public bool IsNearStar { get; set; }

        public string ToInfo()
        {
            var sb = new StringBuilder();
            sb.AppendFormat("{0}", this.Name);
            sb.AppendLine();
            if (!String.IsNullOrEmpty(this.System) && this.System != this.Name)
            {
                sb.AppendFormat("system: {0}", this.System);
                sb.AppendLine();
            }
            sb.AppendFormat("class: {0} ({1})", this.StellarClass, this.StellarClassDescription);
            sb.AppendLine();
            sb.AppendFormat("distance: {0} light years", this.DistanceLightYears);
            sb.AppendLine();
            sb.AppendFormat("apparent magnitude: {0} mV", this.ApparentMagnitude);
            sb.AppendLine();
            sb.AppendFormat("absolute magnitude: {0} MV", this.AbsoluteMagnitude);
            sb.AppendLine();
            if (this.EffectiveTemperature != null)
            {
                sb.AppendFormat("effective temperature: {0:N} K", this.EffectiveTemperature);
                sb.AppendLine();
            }
            if(this.NumberKnownPlanets != null)
            {
                sb.AppendFormat("number known planets: {0}", this.NumberKnownPlanets);
                sb.AppendLine();
            }
            return sb.ToString();
        }
    }
}
